﻿@model RoadFlow.Model.WorkGroup
<script type="text/javascript">
    var win = new RoadUI.Window();
    var validate = new RoadUI.Validate();
</script>
<form method="post">
    @Html.AntiForgeryToken()
    <br />
    <input type="hidden" name="Id" value="@Model.Id" />
    <input type="hidden" name="Sort" value="@Model.Sort" />
    <input type="hidden" name="IntID" value="@Model.IntId" />
    <table cellpadding="0" cellspacing="1" border="0" width="95%" class="formtable">
        <tr>
            <th style="width:80px;">名称：</th>
            <td><input type="text" name="Name" class="mytext" validate="empty" value="@Model.Name" max="100" style="width:75%" /></td>
        </tr>
        <tr>
            <th style="width:80px;">成员：</th>
            <td><input type="text" name="Members" id="Members" class="mymember" value="@Model.Members" style="width:65%" /></td>
        </tr>
        <tr>
            <th style="width:80px;">备注：</th>
            <td><textarea name="Note" class="mytext" style="width:90%; height:50px;">@Model.Note</textarea></td>
        </tr>
    </table>
    <div style="width:95%; margin:10px auto 10px auto; text-align:center;">
        <input type="button" class="mybutton" value="设置菜单" onclick="setMenu();" />
        <input type="button" class="mybutton" onclick="saveWg(this)" value="保存" />
        <input type="button" class="mybutton" onclick="delWg(this);" value="删除" />
        <input type="button" class="mybutton" value="排序" onclick="sort1();" />
    </div>
</form>
<script type="text/javascript">
    function setMenu()
    {
        var url = "SetMenu@(Html.Raw(ViewData["queryString"]))&prevurl=@ViewData["prevUrl"]";
        window.location = url;
        return false;
    }
    function saveWg(but)
    {
        var f = document.forms[0];
        if (validate.validateForm(f))
        {
            var o = RoadUI.Core.serializeForm($(f));
            $(but).prop("disabled", true);
            $.ajax({
                url: "SaveWorkGroup@(Html.Raw(ViewData["queryString"]))", data: o, type: "post", success: function (text)
                {
                    if (RoadUI.Core.checkLogin(text, false))
                    {
                        alert(text);
                    }
                    $(but).prop("disabled", false);
                    parent.frames[0].treecng('1');
                }
            });
        }
    }
    function delWg(but)
    {
        if (!confirm('您真的要删除该工作组吗?'))
        {
            return;
        }
        $(but).prop("disabled", true);
        $.ajax({
            url: "DeleteWorkGroup@(Html.Raw(ViewData["queryString"]))", data: { "__RequestVerificationToken": $("input[name='__RequestVerificationToken']").val() }, type: "post", success: function (text)
            {
                if (RoadUI.Core.checkLogin(text, false))
                {
                    alert(text);
                }
                $(but).prop("disabled", false);
                parent.frames[0].treecng('1');
                window.location = "Empty";
            }
        });
    }
    function sort1()
    {
        window.location = 'WorkGroupSort@(Html.Raw(ViewData["queryString"]))';
    }
</script>